package com.api.oa.services.impl;

import com.api.oa.mapper.YQVideoMapper;
import com.api.oa.model.entity.YQVideo;
import com.api.oa.services.YQVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;


@Service
public class YQVideoServiceImpl implements YQVideoService {

    @Autowired
    private YQVideoMapper mapper;


    @Override
    public Integer add(YQVideo entity) {
        return mapper.insert(entity);
    }

    @Override
    public void remove(Long id) {
        mapper.delete(id);
    }

    @Override
    public Integer update(YQVideo entity) {
        return mapper.update(entity);
    }

    @Override
    public PageInfo<YQVideo> list(String insCode, String keyWord, Integer pageIndex, Integer pageSize) {
        PageHelper.startPage(pageIndex,pageSize);
        PageHelper.orderBy("createdAt desc");
        return new PageInfo<>(mapper.list(insCode,keyWord));
    }

    @Override
    public YQVideo one(Long id) {
     return mapper.findOne(id);
    }



}
